import { GET_POSTS } from '../actions';


const defaultState = {
    posts: [],
    totalPages: 1,
    status: "start"
};

//console.log(JSON.stringify(defaultState));


export default function posts(state = defaultState,action) {
    switch (action.type) {
        case GET_POSTS:
            return {
                posts: action.payload.data,
                totalPages: action.payload.headers && action.payload.headers["x-wp-totalpages"]-0,
                status: "start"
            }

        default:
            return state;


    }

}